<div class="row">
    <div class="span2 bs-docs-sidebar ">
 	   <*include file="<*$controller*>/location.tpl"*>
    </div>
    
<link rel="stylesheet" href="/css/lightbox.css" media="screen"/>
<script src="/js/lightbox-2.6.min.js"></script>
<style type="text/css">
#photolist { width:280px; margin-bottom:5px;}
#photolist img{ width:80px;}
.avatar{ height:40px;}
</style>
			 <form action="/<*$controller*>/fastpublish" method="post" id="f1" >    

  <div class="span10" > 
                 <strong><*$group.groupname*></strong>&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-small" onClick="window.location='/picture/index'" > 切换集团 </button>&nbsp;&nbsp;&nbsp;
                 <*if $uid_class*><strong><*$schoolname*> - <*$classname*></strong>&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary btn-small" onClick="window.location='/picture/publish/groupid/<*$groupid*>'" > 切换校区和班级 </button><*/if*><hr />
  </div>
      
        <*if !$school_class_picture && !$uid_class*>
           <p><div class="alert span6"><strong>恭喜你！</strong>&nbsp;没有需要发布日志的照片！</div></p>
        <*else*>   
            <*if !$uid_class*>
                <div class="span6">
                <table class="table table-bordered table-hover" style="cursor:pointer; margin-top:15px; margin-left:20px;" >
                    <tr><th>有需要发布日志的校区</th><th>&nbsp;</th></tr>
                    <*foreach from =$school_class_picture item=a key=k*>
                    <tr onclick="window.location='/picture/publish/groupid/<*$groupid*>/uid_class/<*$k*>'"><td><*eval var=$a.schoolid assign="schoolidlist"*><*$school.$schoolidlist.schoolname*> - <*$a.classname*></td><td><*$a.number*></td></tr>
                    <*/foreach*>
                </table>
                </div>
            <*/if*>
        <*/if*>
    
    
    <*if $uid_class*>
     <*if !$uploaddatelist *>
         <div class="span6" >
         <p>
             <div class="alert"><strong>恭喜你！</strong>&nbsp;本班级没有需要发布日志的照片！，<a href="/picture/publish/groupid/<*$groupid*>">请返回班级列表</a></div>
             </p>
         </div>
   	<*else*>
    
        <div class="span10 row" >
        <div class="span7"> 
   
   
       	<*if $uploaddatelist*>
        <div class="white-panel">
         <ul class="unstyled inline">
         	<*foreach from=$uploaddatelist item=item key=key*>
         		<li style="width:150px; margin-bottom:10px;" >
                	<a href="/<*$controller*>/<*$action*>/groupid/<*$groupid*>/uid_class/<*$uid_class*>/uploaddate/<*$key*>" class="btn btn-small <*if $key==$uploaddate*>btn-inverse<*/if*>"> <i class="icon-th"></i> <*$key*> (<*$item*>)</a>
                </li>
            <*/foreach*>
         </ul>
         </div>
        <*/if*>


           
                    <*foreach from=$picturelist item=item key=key*>
                    <ul class="clearfix unstyled">
                    <li class="clearfix">
                    <h4><*foreach from=$item.studentinfo item=avatar key=keyavatar*><img src="<*$avatar.filename*>" title="<*$avatar.cnname*>" class="img-polaroid avatar"> <*/foreach*>(<*count($item.studentlist)*>人-<*count($item.piclist)*>张)&nbsp;&nbsp;<button type="button" class="btn btn-success btn-small" onClick="selectall('<*$key*>')" > 选择 <*$item.student*>（<*count($item.studentlist)*>人-<*count($item.piclist)*>片） </button></h4>
                    
                    <div class="row">
                     <*foreach from=$item.piclist item=item1 key=key1*>
                       
                       <div class="white-panel span2 text-center" style="padding:5px 0px;background-color:#fff" id="panel_<*$item1.articlefilesid*>" >
                             
                            <a href="<*$item1.avatar*>.small.jpg" data-lightbox="example-set" title="<a href='<*$item1.avatar*>' target='_blank'>点此链接下载大图</a>" ><img class="img-polaroid" src="<*$item1.avatar*>.tiny.jpg" id="img<*$item1.articlefilesid*>"/></a>  
                            
                            <div class="white-panel-content5">
                             <span style="position:relative; float:right; top:0; right:0; z-index:20;"><a href="javascript:deleteit(<*$item1.articlefilesid*>,0,<*$groupid*>,0,<*$uid_class*>)"><img src="/images/close_pic.png" width="18" title="删除图片" ></a></span>  
                             <label><input type="checkbox"  onclick="checkedov(<*$item1.articlefilesid*>)" name="htmlid[]" id="checkbox_<*$item1.articlefilesid*>" value="<*$item1.articlefilesid*>" />&nbsp;&nbsp;<small>&nbsp;<span title="拍摄时间"><*$item1.uploadtimeDisp*></span></small></label>
                            <small><span id="intro<*$item1.articlefilesid*>"><*if $item1.intro*><*$item1.intro*><*/if*></span>
                            <*if $item1.schedule*><br />课程表：<*$item1.schedule*><*/if*></small>
                           
                            </div>
                        </div>
                     <*/foreach*>
                    </div>
                    <hr />
                    </li>
                    </ul>

                    <*/foreach*>
                    <div class="text-right"> <button type="button" class="btn" onClick="window.location='/picture/oppublishall/groupid/<*$groupid*>/uid_class/<*$uid_class*>/uploaddate/<*$uploaddate*>'" > 一键发布本页全部 </button></div>
</div>
          
                   
			<div class="span2 bs-docs-sidebar" >
            <div data-spy="affix" data-offset-top="0">
                                <p >
                        <button type="submit" class="btn-large btn-primary btn" > 发布日志 </button>
                        <a href="/picture/publish/groupid/<*$groupid*>/uid_class/<*$uid_class*>/uploaddate/<*$uploaddate*>">重选</a>
                    </p>

					<div id="photolist"></div>
                         <p >                      
                         <textarea rows="5" name="title" id="title" placeholder="标题"></textarea></p>
                			<input type="hidden" name="groupid" id="groupid" value="<*$groupid*>"/>
                			<input type="hidden" name="uid_class" id="uid_class" value="<*$uid_class*>"/>
                			<input type="hidden" name="schoolid" id="schoolid" value="0"/>
                			<input type="hidden" name="uploaddate" id="uploaddate" value="<*$uploaddate*>"/>
							<input type="hidden" name="ischecked" id="ischecked" value="0"/>

       </div>        </div>  
        
    <*/if*>
    <*/if*>
    </div>
</form> 

</div>
<!-- script type="text/javascript" src="/js/prototype.js"></script -->
<script type="text/javascript">

function deleteit(aid,page,groupid,schoolid,uid_class)
{
  if(confirm("确定要删除吗？")){
   window.location='/<*$controller*>/pubpicdelete/aid/'+aid+'/page/'+page+'/groupid/'+groupid+'/schoolid/'+schoolid+'/uid_class/'+uid_class;
  }
} 


function checkedov(fileid){
	  
	 var htmlcontent=$('#photolist').html();
	 var photoli='<span id="thumb_'+fileid+'">'+$('#img'+fileid).parent().html()+'</span>';
	 var ischeckedvalue=$('#ischecked').attr("value");
	if($('#checkbox_'+fileid).is(':checked')==true){
		$('#panel_'+fileid).css({'background-color':'#6f6'});
		$('#photolist').html(htmlcontent+photoli);
		$('#ischecked').val(ischeckedvalue*1+1);
	}else{
		$('#panel_'+fileid).css({'background-color':'#fff'});
		$('#thumb_'+fileid).remove();
		$('#ischecked').val(ischeckedvalue*1-1);
	}
	//先获取 标题的内容
	var ti =$('#title').val();
	 
	//判断选中照片的文本是否已经存在标题中
	var con=$('#intro'+fileid).html(); 
	var s = ti.indexOf(con);
	 if(s > -1 ){ 
		}else{ 
		 var a= ti+ con; 
		$('#title').val(a);   
		}
	
	
}

function checkhtml(action){
	
	if(action=='del'){
		if(confirm("确定要删除吗？")){
		   document.getElementById('f1').action='/<*$controller*>/fastpublishdelete';
		}
	}
	
	var checkboxs=document.getElementsByName("htmlid[]");
	var clength=checkboxs.length;
	var isc=0;
	for (var i=0;i<clength;i++) {
		var e=checkboxs[i].value;
		var es=document.getElementById(e);
		if(es.checked==true){
			isc=1;
		}
	}
	if(isc==0){
		alert('请选择照片！');
		return false;
	}
	document.getElementById('f1').submit();
	return true;
}

function xuanhtml() {
	var qxhtml=document.getElementById("qxhtml");
	var checkboxs=document.getElementsByName("htmlid[]");
	var ischecked=document.getElementById("ischecked");
	if(qxhtml.checked==true){
		for (var i=0;i<checkboxs.length;i++) {
			var e=checkboxs[i];
			e.checked=true;
		}
		ischecked.value=1;
	}else{
		for (var i=0;i<checkboxs.length;i++) {
			var e=checkboxs[i];
			e.checked=false;
		}
	}
}

function selectall(id){
	var i=0; 
	var intro = new Array();

	<*foreach from=$picturelist item=item key=key*>
	if(id=='<*$key*>'){
		<*foreach from=$item.piclist item=item1 key=key1*>
		var htmlcontent=$('#photolist').html();
	 	var ischeckedvalue=$('#ischecked').attr("value");
		var photoli='<span id="thumb_<*$item1.articlefilesid*>">'+$('#img<*$item1.articlefilesid*>').parent().html()+'</span>';
		var content=$('#content').text();
		 
		  if(intro.toString().indexOf('<*$item1.intro*>') > -1) {
			//alert("true")
			}else{
			//alert('false');	 
			intro['<*$key1*>']='<*$item1.intro*>';
				} 
		   
		  $('#title').val(intro.join(""));
		 
		 
		 
		$('#panel_<*$item1.articlefilesid*>').css({'background-color':'#6f6'});
		$('#photolist').html(htmlcontent+photoli);
		$('#ischecked').val(ischeckedvalue*1+1);
		$('#content').text(content+$('#intro<*$item1.articlefilesid*>').html());
		$('#checkbox_<*$item1.articlefilesid*>').attr("checked",true);
		i=i+1;
		if(i>=9){
			return 1;
		};
		<*/foreach*>
	}
	<*/foreach*>
}
</script>

